<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>具名插槽(slot)</title>
</head>
<body>
    <div id="app">
        <cpn>
            <button slot="left">按钮</button>
            <span slot="center">标题</span>
            <span slot="right">右边</span>
        </cpn>
    </div>

    <template id="cpn">
        <div>
            <!-- 定义具名插槽:
                1.给slot添加name属性
                2.使用的时候,传入要替换的标签,然后标签上添加slot属性它的值为name的值
            -->
            <slot name="left"></slot>
            <slot name="center"></slot>
            <slot name="right"></slot>
        </div>
    </template>

    <script src="../vue/vue.js"></script>
    <script>
        const cpn = {
            template:'#cpn',
            data() {
                return {
                    
                }
            },
            methods:{

            }
        }
        const app = new Vue({
            el:'#app',
            data:{

            },
            methods: {
                
            },
            components:{
                cpn
            }
        });
    </script>
</body>
</html>